extends Node2D

signal load_ui(level_ui)
## n is number of slots in wand inventory
signal resize_inventory(n: int)

var door_door: PackedScene = preload("res://scenes/objects/doors/cube_doors/16x_16_cube_door._door_1.tscn")
## UI for current level
var level_ui: PackedScene = preload("res://scenes/ui/basic_wand_ui.tscn")
## ESC scene
var esc_scene: PackedScene = preload("res://scenes/ui/menu/esc_ui.tscn")
var a: bool = false
var h: bool = true

# Called when the node enters the scene tree for the first time.
func _ready():
	load_ui.emit(level_ui)
	resize_inventory.emit(2)
	GlobalVar.current_level = 2 as int

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
	if Input.is_action_just_pressed("in_game_menu"):
		if not a:
			$ESC_scene.add_child(esc_scene.instantiate())
			a = true
		else:
			a = false
	if $asaka.position.x > 175 and h: #175
		h = false
		GlobalVar.exit_door_open = false
		$doors.add_child(door_door.instantiate())
		$doors.add_child(door_door.instantiate())
		$doors.get_child(0).position = Vector2(192, 16+8)
		$doors.get_child(1).position = Vector2(192, 32+8)
		$input_buttons/InputButtonTiles.visible = true
